class Solution {
public:
    int evalRPN(vector<string>& tokens) {
         stack<int> st;
         set<string> s={"+","-","*","/"};
         for(auto& str:tokens)
         {
            if(s.find(str)!=s.end())
            {
                int right=st.top();
                st.pop();
                int left=st.top();
                st.pop();
                switch(str[0])
                {
                    case '+':
                    st.push(left+right);
                    break;
                     case '-':
                    st.push(left-right);
                    break;
                     case '*':
                    st.push(left*right);
                    break;
                    case '/':
                    st.push(left/right);
                    break;
                }
            }
            else
            {
                st.push(stoi(str));
            }
         }
          return st.top();
    }
};